package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.PullTeaNetsignService;
import com.yunhai.model.entity.dms.DmsPullTeaNetsignEntity;
import com.yunhai.model.vo.dms.DmsPullTeaNetsignQuery;
import com.yunhai.model.vo.dms.DmsPullTeaNetsignVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/pullTeaNetsign")
public class PullTeaNetsignController {

	@Resource
	private PullTeaNetsignService pullTeaNetsignService;


	/**
	 * 获取 PullTeaNetsign 分页列表
	 */
	@GetMapping("/pagination")
	public Ret getPullTeaNetsignPagination(PaginationVo paginationVo, DmsPullTeaNetsignQuery dmsPullTeaNetsignQuery ) throws Exception {
		IPage page = pullTeaNetsignService.getPullTeaNetsignPagination(paginationVo, dmsPullTeaNetsignQuery );
		return Ret.toPage(page);
	}


	/**
	 * 获取 PullTeaNetsign 所有数据
	 */
	@GetMapping("/allList")
	public Ret getPullTeaNetsignAllList( DmsPullTeaNetsignQuery dmsPullTeaNetsignQuery ) throws Exception {
		List<DmsPullTeaNetsignEntity> list = pullTeaNetsignService.getPullTeaNetsignAllList( dmsPullTeaNetsignQuery );
		return Ret.ok(list);
	}


	/**
	 * 获取 PullTeaNetsign 详情
	 */
	@GetMapping("/{id}")
	public Ret getPullTeaNetsignDetailById(@PathVariable Long id) throws Exception {

	    DmsPullTeaNetsignEntity dmsPullTeaNetsignEntity = pullTeaNetsignService.getPullTeaNetsignDetail(id);
		return Ret.ok(dmsPullTeaNetsignEntity);
	}


	/**
	 * 新增 PullTeaNetsign
	 * */
	@PostMapping("")
	public Ret addPullTeaNetsign(@RequestBody DmsPullTeaNetsignVo dmsPullTeaNetsignVo) throws Exception {

		pullTeaNetsignService.addPullTeaNetsign(dmsPullTeaNetsignVo);
		return Ret.ok();
	}


	/**
	 * 更新 PullTeaNetsign
	 * */
	@PutMapping("")
	public Ret updatePullTeaNetsign(@RequestBody DmsPullTeaNetsignVo dmsPullTeaNetsignVo) throws Exception {

		pullTeaNetsignService.updatePullTeaNetsign(dmsPullTeaNetsignVo);
		return Ret.ok();
	}


	/**
	 * 删除 PullTeaNetsign
	 * */
	@PostMapping("/batchRemove")
	public Ret batchRemovePullTeaNetsign( @RequestBody List<Long> ids ) throws Exception {

	    pullTeaNetsignService.batchRemovePullTeaNetsign(ids);
		return Ret.ok();
	}
}
